import { createRouter, createWebHashHistory } from "vue-router";

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: "/",
      redirect: "/discover",
    },
    {
      path: "/discover",
      redirect: "/discover/recommend",
      component: () => import("@/views/discover/discover-list.vue"),
      meta: {
        title: "发现",
      },
      children: [
        {
          path: "/discover/recommend",
          component: () => import("@/views/discover/recommend-list.vue"),
          meta: {
            title: "推荐",
          },
          name: "recommend",
        },
        {
          path: "/discover/ranking",
          component: () => import("@/views/discover/ranking-list.vue"),
          meta: {
            title: "排行",
          },
          name: "ranking",
        },
        {
          path: "/discover/songs",
          component: () => import("@/views/discover/songs-list.vue"),
          meta: {
            title: "歌单",
          },
          name: "songs",
        },
        {
          path: "/discover/djradio",
          component: () => import("@/views/discover/djradio-list.vue"),
          meta: {
            title: "电台",
          },
          name: "djradio",
        },
        {
          path: "/discover/artist",
          component: () => import("@/views/discover/artist-list.vue"),
          meta: {
            title: "歌手",
          },
          name: "artist",
        },
        {
          path: "/discover/album",
          component: () => import("@/views/discover/album-list.vue"),
          meta: {
            title: "新碟",
          },
          name: "album",
        },
      ],
      name: "discover",
    },
    {
      path: "/friend",
      component: () => import("@/views/friend/friend-list.vue"),
      meta: {
        title: "关注",
      },
      name: "friend",
    },
    {
      path: "/my",
      component: () => import("@/views/my/my-list.vue"),
      meta: {
        title: "我的",
      },
      name: "my",
    },
  ],
  strict: false,
  scrollBehavior: () => ({ left: 0, top: 0 }),
});

export default router;
